home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 April: Mac OS SDK / Dev.CD Apr 96 SDK / Dev.CD Apr 96 SDK1.toast / Development Kits (Disc 1) / OpenDoc / Sample Code / CALib & You… / Documentation / CALib Development Requirements < prev    next >
Encoding:
Text File  |  1995-12-15  |  4.5 KB  |  111 lines  |  [TEXT/ttxt]

  1. CALib Development Requirements
  2. By The OpenDoc™ Engineering Team
  3. December 15, 1995
  4.  
  5.  
  6. © 1993-1995  Apple Computer, Inc. All Rights Reserved.
  7. Apple, the Apple logo, and Macintosh are registered trademarks of Apple Computer, Inc.
  8. Mac and OpenDoc are trademarks of Apple Computer, Inc.
  9. ----------------------------------------------------------------------------------------------------------------------------
  10.  
  11.  
  12. Implementation Requirements
  13.  
  14. Initialization
  15.  
  16.     •    CAInit(), CAShutdown()
  17.  
  18.     •    Menu initialization
  19.  
  20.               Pass the base menu bar (, File, Edit) to CASetMenuBar()
  21.  
  22.     •    Callback Handler Registration
  23.  
  24.     •    Document initialization
  25.  
  26.     •    Register floating windows via CARegisterFloatingWindow().
  27.  
  28.  
  29. Storage
  30.  
  31. The CADocumentRef represent a distinct embedding unit.  The CA may display a single container unit in one window at any given time. How a CADocumentRef maps to a CA document is CA dependent.  A CA may store one CADocumentRef for each CA document (normal case), or multiple CADocumentRef’s for each CA document (multi-window documents).
  32.  
  33. For each embedded frame the CA is given a CAFrameRef with which to refer to that frame.  The CAFrameRef referring to the root frame is a constant value.  The CA needs to maintain content information (size, location, selection state, z-order, etc.)  for each embedded frame.  The CA should treat an embedded frame as a generic content element.
  34.  
  35.  
  36. Event Processing
  37.  
  38.     •    Call CADispatchEvent() first. If false is returned then handle the event.
  39.     •    Must call CADispatchMenuEvent() for menu events.
  40.     •    Call CAAdjustMenus() when a mouse down occurs in the menu bar.
  41.     •    Call CASetSelected() and CAGetSelected() appropriately.
  42.  
  43. The CA needs to handle the following new event types appropriately.
  44.       
  45.     kCAEvtMouseDownEmbedded,
  46.     kCAEvtMouseUpEmbedded,
  47.     kCAEvtMouseUpBorder,
  48.     kCAEvtMouseDownBorder,
  49.     kCAEvtBGMouseDownEmbedded:
  50.  
  51. Although there are HI standards, how events are handled is very application specific.
  52.  
  53.  
  54.  
  55. Focus Tracking
  56.  
  57. The CA needs to maintain (via Focus callback handlers) which root part (CADocumentRef) owns the selection focus (NULL if an embedded part owns the selection focus).  This is the only info the CA has concerning the current focus owner. 
  58.  
  59.  
  60. Callback Handlers (Required)
  61.  
  62.  
  63. FocusLost()
  64.  
  65.     •    Clear current selection
  66.     •    Set current focus owner to NULL (Embedded frame has focus)
  67.  
  68. FocusAcquired()
  69.  
  70.     •    Set current focus owner
  71.     •    Set and display the application menu bar
  72.  
  73. WindowActivate()
  74.  
  75.     •     Activate events are not posted to the system event queue, window activation is handled
  76.            internally by the OpenDoc window state. This is the only notification the CA gets when a
  77.            window is activated or deactivated, actions for activation should be taken here (highlight, scrollbars, etc.)
  78.  
  79. FrameShapeRequest()
  80.  
  81.     •    Need to update internal data structures to reflect the new shape of an embedded frame.
  82.  
  83.  
  84.  
  85. Drawing
  86.  
  87. The CA needs to modify its Update procedure to draw embedded frames  (CADrawFrame()) and the active border (CADrawActiveBorder()).  Update events are not dispatched to OpenDoc, drawing embedded frames is the CA’s responsibility.  Layering frames mixed with native content is controlled by the order in which they’re drawn.
  88.  
  89.  
  90.  
  91. Data Transfer
  92.  
  93. Scrap format
  94.  
  95. The CA needs to modify its clipboard and drag&drop procedures to appropriately interact with CALib.  A total rewrite of the data transfer code will probably be beneficial in most situations.
  96.  
  97. The CA needs to define a new data transfer format (OSType) which represents the new data model of the CA, it must support CA native content plus embedded frames.  This would parallel’s the part kind for a part editor/viewer version of the CA if one existed. 
  98.  
  99. A scrap type of kCAScrapTypeODBentoContainer 'odcn' indicates that an OpenDoc container is on the clipboard.  The document kind of the data transfer document indicates the part kind of the root of the container , the CA either incorporates the part contents (known part kind) or embeds the entire part (unknown part kind).
  100.  
  101.  
  102. Sending (Copy, cut)
  103.  
  104. As opposed to writing to the system scrap, the CA now needs to write it’s scrap data to the target CALib data transfer document (via CAWrite()).  The data flavor is specified by calling CASetDocumentKind() on the data transfer document.   A limitation currently exists in CALib which limits the CA to a single data flavor .
  105.  
  106.  
  107. Receiving (Paste)
  108.  
  109. If an OpenDoc container is present on the system scrap the CA reads the part content data using CARead() on the data transfer document.  To embed the entire container as a part the CALib clone API can be used.
  110.  
  111.